import type { RouteRecordRaw } from 'vue-router'
/**
 * 路由meta对象参数说明
 * meta: {
 *      title:          菜单栏及 tagsView 栏、菜单搜索名称（国际化）
 *      hidden：        是否隐藏此路由
 *      icon：          菜单、tagsView 图标，阿里：加 `iconfont xxx`，fontawesome：加 `fa xxx`
 * }
 */

/**
 * 静态路由（默认路由）:所有人都能看到的路由
 */
export const staticRoutes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/home',
    meta: {
      hidden: true
    }
  },
  {
    path: '/home',
    name: 'Home',
    component: () => import('@/views/home/index.vue'),
    meta: {
      hidden: true
    }
  },
  {
    path: '/cart',
    name: 'Cart',
    component: () => import('@/views/cart/index.vue'),
    meta: {
      hidden: true
    }
  },
  {
    path: '/category',
    name: 'Category',
    component: () => import('@/views/category/index.vue'),
    meta: {
      hidden: true
    }
  },
  {
    path: '/center',
    name: 'Center',
    component: () => import('@/views/center/index.vue'),
    meta: {
      hidden: true
    }
  },
  {
    path: '/detail',
    name: 'Detail',
    component: () => import('@/views/detail/index.vue'),
    meta: {
      hidden: true
    }
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/login/index.vue'),
    meta: {
      hidden: true
    }
  },
  {
    path: '/pay',
    name: 'Pay',
    component: () => import('@/views/pay/index.vue'),
    meta: {
      hidden: true
    }
  },
  {
    path: '/search',
    name: 'Search',
    component: () => import('@/views/search/index.vue'),
    meta: {
      hidden: true
    }
  },
  {
    path: '/worthToBuy',
    name: 'WorthToBuy',
    component: () => import('@/views/worthToBuy/index.vue'),
    meta: {
      hidden: true
    }
  },
  {
    path: '/404',
    name: '404',
    component: () => import('@/views/error/404.vue'),
    meta: {
      hidden: true
    }
  },
  {
    /* 匹配任意的路由 必须放在最后，让除了定义的路由别的都是404 */
    path: '/:pathMatch(.*)',
    name: 'Any',
    redirect: '/404',
    meta: {
      hidden: true
    }
  }
]

/**
 * 定义动态路由:受权限控制的路由
 */
export const allAsyncRoutes: Array<RouteRecordRaw> = []

/**
 * 定义任意路由: 404
 */
export const anyRoute = {
  /* 匹配任意的路由 必须放在最后，让除了定义的路由别的都是404 */
  path: '/:pathMatch(.*)',
  name: 'Any',
  redirect: '/404',
  meta: {
    hidden: true
  }
}
